<?php

/**
 * Colegio form base class.
 *
 * @method Colegio getObject() Returns the current form's model object
 *
 * @package    preuvideo
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseColegioForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'region'           => new sfWidgetFormInputText(),
      'provincia'        => new sfWidgetFormInputText(),
      'comuna'           => new sfWidgetFormInputText(),
      'nombre'           => new sfWidgetFormInputText(),
      'rama_educacional' => new sfWidgetFormInputText(),
      'dependencia'      => new sfWidgetFormInputText(),
      'rbd'              => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'region'           => new sfValidatorString(array('max_length' => 255)),
      'provincia'        => new sfValidatorString(array('max_length' => 255)),
      'comuna'           => new sfValidatorString(array('max_length' => 255)),
      'nombre'           => new sfValidatorString(array('max_length' => 255)),
      'rama_educacional' => new sfValidatorString(array('max_length' => 255)),
      'dependencia'      => new sfValidatorString(array('max_length' => 255)),
      'rbd'              => new sfValidatorInteger(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'Colegio', 'column' => array('rbd')))
    );

    $this->widgetSchema->setNameFormat('colegio[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Colegio';
  }

}
